
;(function($){
    $(function(){
        $("#nav .nav4 .u1 li").on("mouseenter", function(){
            var index = $(this).index()

            $("#hide .hide1").eq(index).show().siblings().hide()
            $("#hide .hide1").eq(index).css("left", index * 70 + 170)
            $("#hide .hide1").eq(index).css("position", "absolute")

            $("#hide .hide1").eq(index).on("mouseleave", function(){
                $(this).hide()
            })

        })
        var timer = setInterval(autoPlay, 2000)
        var imgindex = 0
        var current = 0

        function autoPlay(){
            imgindex++
            current++


            if(imgindex >3){
                imgindex = 1
                $("#banner>ul").css("left", 0)

            }
            if(current >= 3){
                current = 0


            }

            $("#banner>ul").animate({left : -1800 * imgindex}, 1000)

            $("#banner>ol>li").eq(current).addClass("current").siblings().removeClass("current")
        }

        $("#banner ol li").on("click",function(){

            var index=$(this).index()
            console.log($("#banner ol li").eq(index));
            $("#banner ol li").eq(index).addClass("current").siblings().removeClass("current")


            $("#banner>ul").animate({left:-1800 * index},1000)

            imgindex=current=index


        })
        $("#banner").hover(function(){
            clearInterval(timer)
        }, function(){
            timer = setInterval(autoPlay, 2000)
        });


        $(document).on("scroll", function(){

            if($(document).scrollTop() >= 126){
                $("#nav ").css("position", "fixed")
                $("#hide ").css("position", "fixed")
                $("#nav").css("top", 0)
                $("#hide ").css("top", 40)
            } else if($(document).scrollTop() < 126){
                $("#nav ").css("position", "static")
                $("#hide ").css("position", "static")
            }

        })
        console.log($("img"));
        $("img").lazyload({
            effect: "fadeIn",
            placeholder:"../images/66timg.gif"

        })

    })










})(jQuery)
